package com.qfedu.knowledge.exception;

import com.qfedu.knowledge.entity.enums.ResultEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * 自定义异常
 *
 * @ClassName BusinessRuntimeException
 * @Author ykx
 * @Date 2024/1/9 9:39
 * @Version 1.0
 */
@AllArgsConstructor
@NoArgsConstructor
@Setter
@Getter
public class BusinessRuntimeException extends RuntimeException {
    /**
     * 错误码
     */
    private Integer code;

    /**
     * 异常消息
     */
    private String msg;

    /**
     * 分析消息
     */
    private String analysis;

    public BusinessRuntimeException(ResultEnum resultEnum) {
        this.code = resultEnum.getCode();
        this.msg = resultEnum.getMsg();
    }

}
